package cn.edu.bjfu.it.oyss.covid_19helper.ui.my;

import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TabHost;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProvider;
import cn.edu.bjfu.it.oyss.covid_19helper.LoginActivity;
import cn.edu.bjfu.it.oyss.covid_19helper.ProvincesNameActivity;
import cn.edu.bjfu.it.oyss.covid_19helper.R;
import cn.edu.bjfu.it.oyss.covid_19helper.StateActivity;

public class MyFragment extends Fragment {
    public static final int LOGIN_ID = 0;
    private MyViewModel myViewModel;

    public View onCreateView(@NonNull LayoutInflater inflater,
                             ViewGroup container, Bundle savedInstanceState) {
        myViewModel =
                new ViewModelProvider(this).get(MyViewModel.class);
        View root = inflater.inflate(R.layout.fragment_my, container, false);
        //final TextView textView = root.findViewById(R.id.text_my);
        //myViewModel.getText().observe(getViewLifecycleOwner(), s -> textView.setText(s));
        if(LOGIN_ID == 0) {
            Intent intent = new Intent(getActivity(), LoginActivity.class);
            startActivityForResult(intent, LoginActivity.LOGIN_ID_RESULT_CODE);
        }

        return root;
    }
}